/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2024-12-22     Yanzr       the first version
 */
#include "lcd.h"
#include "lcd_app.h"



void Lcd_Sprinrf(uint8_t line,char *format,...)
{
 char string[21];
    va_list arg;
    va_start(arg,format);
    vsprintf(string, format, arg);
    va_end(arg);
    LCD_DisplayStringLine(line,(u8 *)string);


}
uint8_t NUMMM;
void lcd_proc(void *parameter)
{
    while(1)
    {
    rt_mutex_take(ucled_mutex, RT_WAITING_FOREVER);
    Lcd_Sprinrf(Line0,"ucled[0]   %d ",ucled[0]);
//    mcp4017_write(100);
//    mcp4017_read(&NUMMM);
//    Lcd_Sprinrf(Line0,"ADC1:%.2f     ",adc_value[0]);
//    Lcd_Sprinrf(Line1,"ADC2:%.2f     ",adc_value[1]);
//    Lcd_Sprinrf(Line2,"flashR:%d  ",NUMMM);
//    Lcd_Sprinrf(Line3,"hou:%d  ",time.Hours);
//    Lcd_Sprinrf(Line4,"sec:%d  ",time.Seconds);
//    Lcd_Sprinrf(Line5,"ic:%d  ",tim_ic_val);
    rt_thread_mdelay(100);
    rt_mutex_release(ucled_mutex);
    }
}
void lcd_init(void)
{
    LCD_Init();
    rt_thread_delay(50);
    LCD_SetTextColor(White);
    LCD_SetBackColor(Black);
    LCD_Clear(Black);

    rt_thread_t lcd_thread = rt_thread_create("lcd_proc",lcd_proc,RT_NULL,1024,20,10);
    if(lcd_thread!=RT_NULL)
       rt_thread_startup(lcd_thread);

}

